/**
 * 集训经历相关API - 使用统一的运动员API
 */
import type { AthleteTeamExp } from '@/api/athlete/types'
import { getTeamExpListApi, createTeamExpApi, updateTeamExpApi, deleteTeamExpApi } from '@/api/athlete'

/**
 * 查询集训经历列表
 */
export const getTeamExperienceApi = (infoId: string | number) => {
	return getTeamExpListApi(infoId)
}

/**
 * 新增集训经历
 */
export const addTeamExperienceApi = (data: Partial<AthleteTeamExp>) => {
	return createTeamExpApi(data)
}

/**
 * 更新集训经历
 */
export const updateTeamExperienceApi = (id: string | number, data: Partial<AthleteTeamExp>) => {
	// 处理 id 类型转换
	const submitData: Partial<AthleteTeamExp> = {
		...data,
		id: typeof id === 'string' ? parseInt(id) : id
	}

	return updateTeamExpApi(submitData)
}

/**
 * 删除集训经历
 */
export const deleteTeamExperienceApi = (id: string | number) => {
	return deleteTeamExpApi(id)
}
